package com.example.library_hy_advert.system;

import java.util.ArrayList;
import java.util.List;

public enum ScreenType {

    MASTER("主屏", 0x05),

    Sub("副屏", 0x06);

    private final String name;

    private final int flag;

    ScreenType(String name, int flag) {
        this.name = name;
        this.flag = flag;
    }

    public String getName() {
        return name;
    }

    public int getValue() {
        return flag;
    }

    public static List<String> toNameList() {
        List<String> list = new ArrayList<>();
        ScreenType[] values = ScreenType.values();
        for (ScreenType value : values) {
            list.add(value.name);
        }
        return list;
    }

    public static ScreenType get(int ordinal) {
        ScreenType[] values = ScreenType.values();
        for (ScreenType value : values) {
            if (value.ordinal() == ordinal) {
                return value;
            }
        }
        return null;
    }

}